﻿using System;

namespace StationDemo.设备信息.helper
{
    public class ClassCloneHelper
    {
        public static T Clone<T>(T RealObject)
        {
            if (Object.ReferenceEquals(RealObject, null))
            {
                return default(T);
            }
            var serializeSettings = new Newtonsoft.Json.JsonSerializerSettings { ObjectCreationHandling = Newtonsoft.Json.ObjectCreationHandling.Replace };
            return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(Newtonsoft.Json.JsonConvert.SerializeObject(RealObject), serializeSettings);
        }
    }
}
